package org.neogenesis.web.controller;

import java.io.Serializable;
import java.util.List;

import javax.enterprise.context.ConversationScoped;
import javax.inject.Inject;
import javax.inject.Named;

import org.neogenesis.web.dao.GeneDAO;
import org.neogenesis.web.model.Gene;

import org.primefaces.model.LazyDataModel;

@Named
@ConversationScoped
public class GeneController implements Serializable {

	private Gene gene = new Gene();
	
	@Inject
	private GeneDAO geneDAO;

	private List<Gene> genes;

	private LazyDataModel<Gene> lazyModel;

	public GeneController() {
		
	}

	public void setGene(Gene gene) {
		this.gene = gene;
	}

	public Gene getGene() {
		return gene;
	}

	public LazyDataModel<Gene> getLazyModel() {
		return lazyModel;
	}

	public List<Gene> getGeneList() {
		genes= geneDAO.findAll();
		return genes;
	}
	

	public LazyDataModel<Gene> getGeneLazyList() {
		genes= geneDAO.findAll();
		lazyModel = new LazyGeneDataModel(genes);
		return lazyModel;
	}

}
